package com.example.finalassignment.mapper;

import com.example.finalassignment.pojo.User;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.Map;

/**
* @author guocheng
* @description 针对表【user(用户表)】的数据库操作Mapper
* @createDate 2024-05-15 16:30:00
* @Entity com.example.finalassignment.pojo.User
*/
public interface UserMapper {

    int deleteByPrimaryKey(Long id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    /**
     * 根据账号 密码查询user
     */
    User selectByUserNameAndPassword(@Param("username") String username,@Param("password") String password);

    /**
     * 根据id 查询 user userinfo数据
     */
    Map<String,Object> selectByIdToUserAndUserInfo(@Param("id") String id);

    /**
     * 根据name查询user
     */
    User selectByName(@Param("name") String name);

    /**
     * 修改密码
     */
    @Update("update user set password = #{password} where id = #{id}")
    int updateByPassWordToUserId(@Param("id") String id,@Param("password") String password);

}
